package com.sso.utils;

/**
 * 返回json对象的工具类
 *
 * @author : alex
 * @date : 2020/1/28
 */
public class Result {

    /**
     * 私有化构造器
     */
    private Result() {

    }

    private String code;

    private String msg;

    private Object obj;

    public Result(String code, String msg, Object obj) {
        super();
        this.code = code;
        this.msg = msg;
        this.obj = obj;
    }

    public Result(Object obj) {
        super();
        this.obj = obj;
    }

    public static Result buildIsOk(Object obj) {
        return new Result("00000", "ok", obj);
    }

    public static Result buildIsFail(Object obj) {
        return new Result("B0001", "fail", obj);
    }

    public static Result build(String code, String msg, Object obj) {
        return new Result(code, msg, obj);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getObj() {
        return obj;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }

}
